<style scoped>
.layout{
    border       : 1px solid #d7dde4;
    background   : #f5f7f9;
    position     : relative;
    border-radius: 4px;
    overflow     : hidden;
}
.layout-logo{
    width        : 100px;
    height       : 30px;
    background   : #5b6270;
    border-radius: 3px;
    float        : left;
    position     : relative;
    top          : 15px;
    left         : 20px;
}
.layout-nav{
    width       : 420px;
    margin      : 0 auto;
    margin-right: 20px;
}
</style>
<template>
    <div class="layout">
<<<<<<< HEAD
        <div v-if="login">
           {{$login}}
        {{$store.state.token}}
=======
        <!-- <div v-if="login"> -->
            <!-- {{$store.state.token}} -->
>>>>>>> e15b3771d8c2eafb94b694cfc667a918ce83fecc
        <Layout>
            <Header>
                <Menu mode="horizontal" theme="dark" active-name="1">
                    <div class="layout-logo"></div>
                    <div class="layout-nav">
                        <MenuItem name="1">
                            <Icon type="ios-navigate"></Icon>
                            后台管理
                        </MenuItem>
                        <MenuItem name="2">
                            <Icon type="ios-keypad"></Icon>
                            管理员登录
                        </MenuItem>
                        <MenuItem name="3">
                            <Icon type="ios-analytics"></Icon>
                            管理员注销
                        </MenuItem>
                    </div>
                </Menu>
            </Header>
        </Layout>
        <Layout>
                <Sider hide-trigger :style="{background: '#fff'}">
                    <Menu active-name="1-2" theme="light" width="auto" :open-names="['1']">
                         <Submenu name="2">
                            <template slot="title">
                                <Icon type="ios-keypad"></Icon>
                                用户管理
                            </template>
                            <MenuItem name="2-1"><router-link to="/user">用户管理</router-link></MenuItem>
                        </Submenu>
                        <Submenu name="3">
                            <template slot="title">
                                <Icon type="ios-analytics"></Icon>
                                论坛管理
                            </template>
                            <MenuItem name="3-1">
                                 <router-link to="/comment">发帖管理</router-link>
                                 </MenuItem>
                        </Submenu>
                          <Submenu name="4">
                            <template slot="title">
                                <Icon type="ios-analytics"></Icon>
                                百科管理
                            </template>
                           <router-link to='/encyclopedia'> <MenuItem name="4-1">狗</MenuItem></router-link>
                           <router-link to='/encyclopedia'> <MenuItem name="4-2">猫</MenuItem></router-link>
                        </Submenu>
                        <Submenu name="5">
                            <template slot="title">
                                <Icon type="ios-analytics"></Icon>
                                活动管理
                            </template>
                            <MenuItem name="5-1">
                                <router-link to="/active">活动管理</router-link>
                            </MenuItem>
                        </Submenu>
                        <Submenu name="6">
                            <template slot="title">
                                <Icon type="ios-analytics"></Icon>
                                <router-link to="/photo">美图管理</router-link>
                            </template>
                            <MenuItem name="6-1">
                                <router-link to="/photo">发布美图竞赛帖</router-link>
                            </MenuItem>
                            <MenuItem name="6-2">用户评论贴</MenuItem>
                            <MenuItem name="6-3">用户评论用户</MenuItem>
                            <MenuItem name="6-4">用户竞赛页</MenuItem>
                            <MenuItem name="6-5">
                                <router-link to="/postphoto">上传图片</router-link>
                            </MenuItem>
                        </Submenu>
                        <Submenu name="7">
                            <template slot="title">
                                <Icon type="ios-analytics"></Icon>
                                服务管理
                            </template>
                            <MenuItem name="7-1">
                                 <router-link to="/getServer" >宠物领养</router-link>
                            </MenuItem>
                            <MenuItem name="7-2">
                                <router-link to="/server" >宠物找寻</router-link>
                            </MenuItem>
                        </Submenu>
                            <Submenu name="8">
                            <template slot="title">
                                <Icon type="ios-analytics"></Icon>
                                <router-link to="/cate" >分类管理</router-link>
                            </template>
                        </Submenu>
                    </Menu>
                </Sider>
                <Layout :style="{padding: '0 24px 24px'}">
                    <Breadcrumb :style="{margin: '24px 0'}">
                        <BreadcrumbItem>Home</BreadcrumbItem>
                        <BreadcrumbItem>Components</BreadcrumbItem>
                        <BreadcrumbItem>Layout</BreadcrumbItem>
                    </Breadcrumb>
                    <Content :style="{padding: '24px', minHeight: '280px', background: '#fff'}">
                        <router-view></router-view>
                    </Content>
                </Layout>
            </Layout>
        </div>
</template>
<script>
import {mapActions} from 'vuex';
export default{
    data () {
            return {
                formInline: {
                    name    : '',
                    password: ''
                },
                ruleInline: {
                    name: [
                        { required: true, message: 'Please fill in the user name', trigger: 'blur' }
                    ],
                    password: [
                        { required: true, message: 'Please fill in the password.', trigger: 'blur' },
                        { type: 'string', min: 4, message: 'The password length cannot be less than 6 bits', trigger: 'blur' }
                    ]
                }
            }
        },
        methods: {
            ...mapActions(['checkLogin','setToken']),
            handleSubmit(name) {
                this.$refs[name].validate(valid => {
                    if (valid) {
                        this.checkLogin(true);
                        //console.log(checkLogin);
                        this.setToken(
                           'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoxLCJuYW1lIjoiYSIsInBhc3N3b3JkIjoiYWFhYWEifSwiaWF0IjoxNTQxOTkyMzMyfQ.Fytag0VA706xy0Y9ygW-5sU3lq-6aiSQNMyOc9RwozU'
                           );
                        this.$Message.success('Success!');
                        //console.log(setToken);
                    } else {
                        this.$Message.error('Fail!');
                    }
                })
            }
        },
    computed:{
        login(){
            return this.$store.getters.login;
        }
    }
}
</script>
